IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GeographyTier]') AND type in (N'U'))
DROP TABLE [dbo].[GeographyTier]
GO

CREATE TABLE [dbo].[GeographyTier](
	[Key] [uniqueidentifier] NOT NULL DEFAULT NEWID(),
	[ParentKey] [uniqueidentifier] NOT NULL,
	[TierValue] [int] NOT NULL,--0: Country; 1: State, 2: County, 3: City, 4: District, 5: Street
	[Name] [nvarchar](max) NOT NULL,
	[PostCode] [nvarchar](10) NULL,
	[TelCode] [nvarchar](10) NULL,
	[CountryKey] [uniqueidentifier] NOT NULL,
	[CreatedStamp] [datetime] NOT NULL DEFAULT getutcdate(),
	[LastUpdatedStamp] [datetime] NOT NULL DEFAULT getutcdate(),
	[State] [int] NOT NULL DEFAULT 0,
 CONSTRAINT [PK_GeographyTier] PRIMARY KEY CLUSTERED 
(
	[Key] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO